<%@ page import="com.entity.Page" %><%--
  Created by IntelliJ IDEA.
  User: jiangcuizhi
  Date: 2023/12/6
  Time: 10:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<link rel="stylesheet" href="${ctx}/public/css/adminMessage.css" media="all">
<link rel="stylesheet" href="${ctx}/public/css/bootstrap.css" media="all">
<head>
    <title>Title</title>
</head>
<style>
    select{
        width: 200px;
        height: 40px;
        float: left;
        margin: 18px 15px;
        border-radius: 10px;
        border:1px solid rgb(220,223,230);
    }
</style>
<body>
<div class="content">
    <form method="post" action="${ctx}/bookBorrow" class="one">
        <input type="text" placeholder="借阅人姓名" name="name" value="${name}"/>
        <strong style="margin-top: 30px;float: left">OR</strong>
        <input type="text" placeholder="图书名称" name="typeOrAuthor" value="${typeOrAuthor}"/>
        <select id="borrowConditionSort" name="conditionSort" lay-verify="required">
            <option value="ASC" <c:if test="${conditionSort=='ASC'}">selected</c:if>>升序</option>
            <option value="DESC" <c:if test="${conditionSort=='DESC'}">selected</c:if>>降序</option>
        </select>
        <button type="submit" style="background-color: rgb(64, 158, 255);margin: 23px;color: black">搜索</button>
        <button class="cleanLimit" type="submit" style="background-color: rgb(64, 158, 255);margin: 23px;color: black">ALL</button>
    </form>

    <ul style="margin-bottom: 0">
        <li>借阅记录ID</li>
        <li>图书ID</li>
        <li>图书名称</li>
        <li>借阅者ID</li>
        <li>借阅人姓名</li>
        <li>借阅时间</li>
        <li>借阅期限</li>
        <li>是否归还</li>
        <li>操作</li>
    </ul>
    <!-- 数据 -->

    <div class="data-box">
        <c:forEach items="${p.data}" var="admin">
            <ul class="model" style="margin-bottom: 0">
                <li>${admin.operatid}</li>
                <li>${admin.bookid}</li>
                <li>${admin.bookname}</li>
                <li>${admin.userid}</li>
                <li>${admin.username}</li>
                <li>${admin.borrowtime}</li>
                <li>${admin.renttime}</li>
                <li>${admin.isreturn}</li>
                <li>
                    <button style="height: 40px;" onclick='location.href="${ctx}/deleteBook?bookid=${book.bookid}&pageNumber=${p.pageNumber}&name=${param.name}&typeOrAuthor=${param.typeOrAuthor}&conditionSort=${param.conditionSort}"'><h4 style="text-align: center">删除</h4></button>
                </li>
            </ul>
        </c:forEach>
    </div>
    <jsp:include page="page.jsp">
        <jsp:param name="url" value="${ctx}/bookBorrow"></jsp:param>
        <jsp:param name="name" value="${name}"/>
        <jsp:param name="typeOrAuthor" value="${typeOrAuthor}"/>
        <jsp:param name="conditionSort" value="${conditionSort}"/>
    </jsp:include>
</div>
<script>
    document.querySelector('.cleanLimit').addEventListener('click', function() {
        document.getElementsByName('name')[0].value = '';
        document.getElementsByName('typeOrAuthor')[0].value = '';
        document.getElementById("borrowConditionSort")[0].selected=true;
        this.form.submit();
    });
</script>
</body>
</html>
